package service.impl;

import dao.PetDao;
import entity.Pet;
//import factory.PetDaoFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import service.PetService;
@Service("petService")
public class PetServiceImpl implements PetService {
    //1.创建PetDao实现类对象
    //PetDao petDao = new PetDaoMySQLImpl();
    @Override
    public boolean save(Pet pet) {
        return petDao3.insert(pet) > 0;
    }

    //2.通过指定的名称获取PetDao实例
//    PetDao petDao2 = PetDaoFactory.getInstance(PetDaoFactory.defaultBeanName);


    //3.提供petDao属性和对应的getter/setter方法
    @Autowired
//    @Resource(name = "petDaoMySQL")
//    @Resource(type = PetDaoOracleIImpl.class)?
    @Qualifier("petDaoOracleIImpl")
    private PetDao petDao3;
    public PetDao getPetDao3() {
        return petDao3;
    }

    public void setPetDao3(PetDao petDao3) {
        this.petDao3 = petDao3;
    }
}
